//
//  JFNoteCell.m
//  JobFree2.0
//
//  Created by xxcao on 2017/5/26.
//  Copyright © 2017年 Dale. All rights reserved.
//

#import "JFNoteCell.h"
#import "YYKit.h"

@implementation JFNoteCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    double itemWidth = (Screen_Width - 5 * 10.0 - kNoteOffSet) / 4.0;
    self.height = itemWidth;
    self.width = itemWidth;
    setViewCorner(self, 4);
}

- (void)reloadNoteCellData:(id)noteObject {
    if (noteObject) {
        self.contentLab.displaysAsynchronously = YES;
        self.contentLab.ignoreCommonProperties = YES;
        
        // Create attributed string.
        NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@"[图文]如果你是一枚Coder,但是你不知道Github,那么我觉的你就不是一个菜鸟级别的Coder,因为你压根不是真正Coder,你只是一个Code搬运工。但是你如果已经在读这篇文章了如果你是一枚Coder，但是你不知道Github，那么我觉的你就不是一个菜鸟级别的Coder，因为你压根不是真正Coder，你只是一个Code搬运工。但是你如果已经在读这篇文章了，我觉的你已经知道Github了"];
        text.font = [UIFont systemFontOfSize:12];
        text.color = [UIColor colorWithHexString:@"333333"];
        
        // Create text container3
        YYTextContainer *container = [YYTextContainer new];
        container.size = CGSizeMake(self.width - 6, self.height - 17);
        container.maximumNumberOfRows = 5;
        container.truncationType = YYTextTruncationTypeEnd;
        
        // Generate a text layout.
        YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:text];
        dispatch_async(dispatch_get_main_queue(), ^{
            self.contentLab.size = layout.textBoundingSize;
            self.contentLab.textLayout = layout;
        });
    }
}

@end
